package com.springboot.logback;

import com.springboot.logback.utils.ILogger;
import com.springboot.logback.utils.LoggerManager;
import org.springframework.boot.WebApplicationType;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.web.bind.annotation.RestController;

/**
 * Hello world!
 *
 */
@SpringBootApplication
@RestController
public class App 
{
    //定义一个全局的记录器，通过LoggerFactory获取
    private static final ILogger logger = LoggerManager.getLogger(App.class);

    public static void main(String[] args) {
        ConfigurableApplicationContext context = new SpringApplicationBuilder(App.class)
                .web(WebApplicationType.SERVLET).run(args);
        // main1();
        logger.info("启动完成");
    }

    public static void main1()
    {
        System.out.println( "Hello World!" );
        logger.info("test logger console!");

        StringBuilder sb = new StringBuilder();
        sb.append("leihao");
        sb.append("wender");
        String newStr = sb.substring(0,sb.length());

        System.out.println(sb.toString().equals(newStr));
        System.out.println(sb.length());
        System.out.println(sb);
        System.out.println(newStr);
    }
}
